package com.bawei.lib_base.utils

import androidx.room.Delete
import com.bawei.lib_base.entity.*
import com.bawei.lib_base.res.Res
import okhttp3.RequestBody
import retrofit2.http.*

interface ApiService{
    @POST("/api/user/login")
    suspend fun getUserLogin(@Query("password")password : String,@Query("username")username : String) : Res<UserBean>

    @POST("/api/user/register")
    suspend fun getUserRegister(@Query("password")password: String,@Query("username")username: String) : Res<UserBean>

    //公告
    @GET("/api/announcements")
    suspend fun getNotice(@Query("page")page : Int,@Query("size")size : Int) : Res<NoticeBean>

    //车位
    @GET("/api/parking-spaces/area/{areaId}")
    suspend fun getParkArea(@Path("areaId")areaId : Int) : Res<ParkBean>

    @GET("/api/parking-spaces/type/{spaceType}")
    suspend fun getParkType(@Path("spaceType")spaceType : String) : Res<ParkBean>

    @GET("/api/parking-spaces/status/{spaceStatus}")
    suspend fun getParkStatus(@Path("spaceStatus")spaceStatus : String) : Res<ParkBean>

    @GET("/api/parking-spaces/license/{licensePlate}")
    suspend fun getParkLicense(@Path("licensePlate")licensePlate : String) :Res<ParkBean>

    @POST("/api/parking-spaces")
    suspend fun getParkAdd(@Body body: RequestBody) : Res<ParkBeanItem>

    @PUT("/api/parking-spaces/{id}")
    suspend fun updatePark(@Path("id") id: Int, @Body body: RequestBody): Res<ParkBeanItem>

    @DELETE("/api/parking-spaces/{id}")
    suspend fun getParkDelete(@Path("id")id : Int) : Res<ParkBean>

    //预约来访
    @GET("/api/visit-appointments")
    suspend fun getVisit() : Res<VisitBean>

    @GET("/api/visit-appointments/status/{status}")
    suspend fun getVisitStatus(@Path("status")status : String) : Res<VisitBean>

    @GET("/api/visit-appointments/search/name")
    suspend fun getVisitName(@Query("name")name : String) : Res<VisitBean>

    @POST("/api/visit-appointments")
    suspend fun getVisitAdd(@Body body: RequestBody) : Res<VisitBeanItem>

    @GET("/api/visit-appointments/{id}")
    suspend fun getVisitDetail(@Path("id")id : Int) : Res<VisitBeanItem>

    @PATCH("/api/visit-appointments/approve/{id}")
    suspend fun getVisitApprove(@Path("id")id : Int) : Res<VisitBeanItem>

    @PATCH("/api/visit-appointments/reject/{id}")
    suspend fun getVisitReject(@Path("id")id : Int) : Res<VisitBeanItem>

    //设备维修
    @GET("/api/repair-orders")
    suspend fun getRepair() : Res<RepairBean>

    @GET("/api/repair-orders/search")
    suspend fun getRepairSearch(@Query("repairName")repairName : String) : Res<RepairBean>

    @POST("/api/repair-orders")
    suspend fun getRepairAdd(@Body body: RequestBody) : Res<RepairBeanItem>

    //考勤打卡
    @POST("/api/attendances")
    suspend fun getSing(@Body body: RequestBody) : Res<SingBeanItem>

    @GET("/api/attendances/user/{userId}")
    suspend fun getSingUserId(@Path("userId")userId : Int) : Res<SingBean>
}